package com.qingcloud.fexecutor.base.enums;

public enum BaseAppCategoryEnum {

    APPLICATION(1, "业务应用"),
    DATABASE(2, "数据库"),
    CACHE(3, "缓存"),
    MESSAGE_QUEUE(4, "消息队列"),
    SYSTEM(5, "操作系统"),
    IDE(6, "开发工具");

    public final Integer code;
    public final String name;

    BaseAppCategoryEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (BaseAppCategoryEnum type : BaseAppCategoryEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static BaseAppCategoryEnum findByName(String name) {
        for (BaseAppCategoryEnum type : BaseAppCategoryEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }
}
